var ec2_Createlb = {
    ec2ui_session : null,
    retVal : null,
    selection : null,
    launch : function() {
  
        this.retVal.LoadBalancerName = document.getElementById("ec2ui.createlb.Name").value.trim();
	this.retVal.Protocol = document.getElementById("ec2ui.createlb.Protocol").value.trim();
        this.retVal.elbport = document.getElementById("ec2ui.createlb.elbport").value.trim();
	this.retVal.instanceport = document.getElementById("ec2ui.createlb.instanceport").value.trim()
        this.retVal.Interval = document.getElementById("ec2ui.createlb.Interval").value.trim();
	this.retVal.Timeout = document.getElementById("ec2ui.createlb.timeout").value.trim();
	this.retVal.HealthyThreshold = document.getElementById("ec2ui.createlb.HThreshold").value.trim();
	this.retVal.UnhealthyThreshold = document.getElementById("ec2ui.createlb.uThreshold").value.trim();
	this.retVal.Instances = document.getElementById("ec2ui.createlb.Instancelist").value;
	this.retVal.ok = true;
        return true;
    },
    init : function() {
        this.ec2ui_session = window.arguments[0];
        this.retVal = window.arguments[1];
	
	var theList = document.getElementById('theList');
	//alert("Here");
	var Instanceid = this.ec2ui_session.model.getInstances();
	alert(Instanceid);
	theList.setAttribute('editable', true);
	for (var i in Instanceid) {
	    var row = document.createElement('listitem');
	    var cell = document.createElement('listcell');
	    var check = document.createElement('checkbox');
	   
	    row.appendChild(check);
	   
	    cell.setAttribute('label', Instanceid[i].id);
	    row.appendChild(cell);
	
	    cell = document.createElement('listcell');
	    cell.setAttribute('label',  Instanceid[i].placement.availabilityZone);
	    row.appendChild(cell);
	
	    theList.appendChild(row);
	}
//	var theList2 = document.getElementById('theList2');
//	var myreg = document.getElementById('myreg');
//	alert("Here");
//	var Instanceid = this.ec2ui_session.model.getInstances();
//	for (var i in Instanceid) {
//	    var item = document.createElement('treeitem')
//	    var row = document.createElement('treerow');
//	    var cell = document.createElement('treecell');
//	    var check = document.createElement('checkbox');
//	    
//	    
//	   
//	    cell.setAttribute('label', Instanceid[i].id);
//	    row.appendChild(cell);
//
//	    cell = document.createElement('treecell');
//	    cell.setAttribute('label',  Instanceid[i].placement.availabilityZone);
//	    row.appendChild(cell);
//	    
//            item.appendChild(row);
//            myreg.appendChild(item);
	    //theList2.appendChild(row);
	//}

   
       
    }
}